package com.charlotte.study.gupao.command.ftp;

import com.charlotte.study.gupao.command.ftp.command.ICommand;

import java.util.ArrayList;
import java.util.List;

/**
 * @author junjie.ding
 * @date 2020/3/16
 */
public class SSHClient {

    private List<ICommand> commands;

    public SSHClient(List<ICommand> commands) {
        this.commands = commands;
    }

    public SSHClient() {
        this.commands = new ArrayList<>();
    }

    public SSHClient addCommand(ICommand command){
        this.commands.add(command);
        return this;
    }

    public void execute(ICommand command){
        command.execute();
    }

    public void executes(){
        commands.forEach(command -> command.execute());
        commands.clear();
    }

}
